
import Goods  from "./goods.js" 
import {hashHistory} from "react-router"


import store from "../../store/store";
export default React.createClass({ 
	getInitialState(){
        return {
            init :{
            	goodsbanner :[],
            	goodspric:{
            		goods_name:"",
            		goods_price:"",
            		goods_salenum:"",
            		goods_strorage:"",
            		goods_eval_list:[]
            	},
            	goodstui:[],
            	car:{
					id:"",
					img:"",
					conent:"",
					pric:"",
					num:""
				}
            }
        }
 }, 
	componentWillMount:function(){  
	 	 
 }, 	
 updateView(){ //此处为提供的更新视图方法
        var newData = store.getState(); 
        this.setState(
              {
              	init :newData.goodsinit
              }
        ) 
   },
   removeSubscribe : null,
componentWillUnmount(){
        //组件即将被卸载  记得注销更新视图函数
        this.removeSubscribe();
    },
    
 componentDidMount:function(){
 	this.removeSubscribe= store.subscribe(this.updateView);
 	var that =this
// 	setInterval(function(){ 
// 	},1000)
 },
	render : function(){
		return (
			<Goods data={this.state.init}/>
		)
	}
})
